/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.handler;

import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.AbstractLeaveHandler;
import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.LeaveRequest;

/**
 * 总经理处理类
 *
 * @author zhaorongzhang
 * @version GManagerLeaveHandler.java, v 0.1 2020/1/18 4:01 下午 zhaorongzhang Exp $$
 */
public class GManagerLeaveHandler extends AbstractLeaveHandler {

    public GManagerLeaveHandler(String name) {
        this.handlerName = name;
    }

    @Override
    public void handlerRequest(LeaveRequest leaveRequest) {
        if (leaveRequest.getLeaveDays() > this.MIDDLE && leaveRequest.getLeaveDays() <= this.MAX) {
            System.out.println("总经理:" + handlerName + ", 已处理; 流程结束.");
            return;
        }

        if (this.nextHandler != null) {
            this.nextHandler.handlerRequest(leaveRequest);
        } else {
            System.out.println("审批结束");
        }

    }

}